/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package democarmanagement;

import com.mysql.jdbc.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Minhdaica
 */
public class DBConnection {

    private String url = "jdbc:mysql://localhost:3306/db_car";
    private Connection con;
    private String Driver = "com.mysql.jdbc.Driver";

    public Connection getConnection() {

        try {
            Class.forName(Driver);
            con = (Connection) DriverManager.getConnection(url, "root", "");
            return con;
        } catch (SQLException ex) {
            ex.printStackTrace();
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();
        }
        return null;
    }
}
